HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpyourdayfloraldesign/wp-content/plugins/wp-rollback/src/Core/ServiceProvider.php
<?php

/**
 * Service Provider
 *
 * @package WpRollback\Free\Core
 * @since 3.0.0
 */

declare(strict_types=1);

namespace WpRollback\Free\Core;

use WpRollback\SharedCore\Core\DebugMode;
use WpRollback\SharedCore\Core\Cache;
use WpRollback\SharedCore\Core\Exceptions\BindingResolutionException;
use WpRollback\SharedCore\Core\Contracts\ServiceProvider as ServiceProviderContract;
use WpRollback\Free\Core\Constants;
use WpRollback\SharedCore\Core\SharedCore;
use WpRollback\SharedCore\Core\BaseConstants;
use WpRollback\SharedCore\Core\Request;
use WpRollback\Free\PluginSetup\PluginScripts;

/**
 * Class ServiceProvider
 *
 * @package WpRollback\Free\Core
 */
class ServiceProvider implements ServiceProviderContract
{
    /**
     * This function registers the service provider.
     *
     * @since 3.0.0
     * @throws BindingResolutionException
     */
    public function register(): void
    {
        // Create a single instance of Constants
        $constants = new Constants();

        // Bind both BaseConstants and Constants to the same instance
        SharedCore::container()->singleton(BaseConstants::class, function () use ($constants) {
            return $constants;
        });

        SharedCore::container()->singleton(Constants::class, function () use ($constants) {
            return $constants;
        });

        // Register Request with Constants dependency
        SharedCore::container()->singleton(Request::class, function () use ($constants) {
            return new Request($constants);
        });

        // Register other services using the same constants instance
        SharedCore::container()->singleton(Cache::class, function () use ($constants) {
            return new Cache($constants->getSlug());
        });

        SharedCore::container()->singleton(DebugMode::class, function () {
            return DebugMode::makeWithWpDebugConstant();
        });

        // Register PluginScripts
        SharedCore::container()->singleton(PluginScripts::class);
    }

    /**
     * This function boots the service provider.
     *
     * @since 3.0.0
     */
    public function boot(): void
    {
    }
}